/*
 * @Author: szx
 * @Date: 2022-06-04 10:21:19
 * @LastEditTime: 2022-06-04 10:29:44
 * @Description:
 * @FilePath: \leetcode\800-899\829\829.js
 */
/**
 * @param {number} n
 * @return {number}
 */
var consecutiveNumbersSum = function (n) {
    let ans = 0;
    //条件②
    for (let k = 1; k * k < 2 * n; k++) {
        //条件①和条件③
        if (2 * n % k == 0 && (2 * n / k - k + 1) % 2 == 0) {
            ans++;
        }
    }
    return ans;

};
